<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 16:06
 */
//定义命名空间
namespace test;

//use、require 需要用到的类
use test\user\common;
use test\user\VIP1;
use test\user\VIP2;
use test\user\VIP3;

require 'user\common.php';
require 'user\VIP1.php';
require 'user\VIP2.php';
require 'user\VIP3.php';

class manager
{
    //定义一个可以使user对象在manager类结束后清除的数组
    public $arr =[] ;
    //开始
    public function begin(){
        $this->arr[] = $this->createuser(0);
        $this->arr[] = $this->createuser(1);
        $this->arr[] = $this->createuser(2);
        $this->arr[] = $this->createuser(3);
    }
    //判断用户传入的参数创建对应的对象
    public function createuser($level){
        $user = '';
        switch ($level){
            case 0 :
                $user = new common();
                break ;
            case 1 :
                $user = new VIP1();
                $user->send();
                break ;
            case 2 :
                $user = new VIP2();
                break ;
            case 3 :
                $user = new VIP3();
                break ;
        }
        $user->mylevel();
        $this->onlinenum();
        return $user;
    }
    public function onlinenum(){
        echo '<br />在线人数：'.(common::$count).'<br />';
    }
}
$m = new manager();
$m->begin();
